#include <string>
#include <boost/any.hpp>
#include <map>

class PropertyList
{
public:
	void Insert( const std::string& name, boost::any value )
	{
		propertyMap_[name] = value;
	}
	void Remove( const std::string& name )
	{
		std::map<std::string, boost::any>::iterator iter = propertyMap_.find(name);
		if(iter!=propertyMap_.end())
			propertyMap_.erase(iter);
	}
	template< class T >
	bool GetValue( const std::string& name, T& value )
	{
		std::map<std::string, boost::any>::const_iterator iter = propertyMap_.find(name);
		if(iter!=propertyMap_.end())
		{
			try
			{
				value = boost::any_cast<T>(iter->second);
				return true;
			}
			catch(const boost::bad_any_cast &)
			{
				return false;
			}
		}
		else
			return false;
	}
private:
	std::map<std::string, boost::any> propertyMap_;
};